<template>
  <div>
    <el-dialog
      title="列表"
      :visible.sync="show"
      @close="$emit('update:show', false)"
    >
      <BaseTable
        :data.sync="data"
        :config="config"
        :currentRow.sync="currentRow"
      ></BaseTable>
      <div slot="footer">
        <el-button @click="choose">选择</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import BaseTable from "./baseTable.vue";
export default {
  props: ["show"],
  components: {
    BaseTable,
  },
  data() {
    return {
      currentRow: null,
      config: [
        { type:'radio' },
        { label: "序号", prop: "no" },
        { label: "班级", prop: "class" },
      ],
      data: [
        { no: 1, class: "班级1" },
        { no: 2, class: "班级2" },
      ],
    };
  },
  methods: {
    choose() {
      if (!this.currentRow) {
        this.$message({
          type: "info",
          message: "请选择一条数据",
        });
        return;
      }
      this.$parent.$refs.dialog.showDialog();
    },
  },
};
</script>

<style lang="scss" scoped></style>
